Skip to content

Add direct whisper or teleport#1293

Closed
Mizkii wants to merge 3 commits into
PathOfBuildingCommunity:devfrom
Mizkii:direct-whisper-or-teleport
Closed

Add direct whisper or teleport#1293
Mizkii wants to merge 3 commits into
PathOfBuildingCommunity:devfrom
Mizkii:direct-whisper-or-teleport

Conversation

@Mizkii

@Mizkii Mizkii commented Sep 3, 2025

Copy link
Copy Markdown
Contributor

Fixes #748

Includes #1289

Description of the problem being solved:

This PR overhauls the trade interaction workflow by implementing direct in-game actions from the Trader pane. Previously, all trades required copying a whisper message to the clipboard and manually pasting it in-game. This feature streamlines the process by sending whispers and hideout teleports directly via the trade API.

The new functionality includes:

  • Direct Hideout Teleport: When an item listing provides a hideout_token, the button changes to "Teleport" and sends the user directly to the seller's hideout.
  • Direct Whisper: For listings with a whisper_token, the button sends the trade whisper directly to the player in-game.
  • Smart Fallback: If a direct action fails (e.g., due to an API error) or if only a legacy whisper string is available, the system automatically falls back to copying the message to the clipboard, ensuring no loss of functionality.
  • On-Demand Token Refresh: To prevent expired tokens, fresh data is fetched for an item the moment it is selected from the results list.

Steps taken to verify a working solution:

  • Manually tested the Trader functionality against the live trade site, confirming that both "Teleport" and "Whisper" actions were successful.
  • Verified the button UI correctly updates its text and action based on the hideout_token or whisper_token present in the API response.
  • Confirmed that failed API calls (simulated and actual) correctly trigger the fallback mechanism, copying the whisper to the clipboard.
  • Successfully ran the entire project test suite, in the Docker environment using docker-compose up.

Link to a build that showcases this PR:

Not applicable. This is a core feature enhancement for the Trader and is not build-specific.

Before screenshot:

image

The Trader pane UI before this change, with only a single "Whisper" button that copied text.

After screenshot:

Whisper :

image image image

Teleport :
image
image

The Trader pane UI with the new dynamic button, showing "Whisper" with a whisper_token or "Teleport" for an item with a hideout token.

Docker Test:

image

@Mizkii Mizkii changed the title Direct whisper or teleport Add direct whisper or teleport Sep 3, 2025
@Wires77 Wires77 added enhancement New feature, calculation, or mod pob1 Should also be merged into PoB1 Repo labels Sep 4, 2025
Comment on lines +1166 to +1189
local index = self.itemIndexTbl[row_idx]
if not index then return end

local selectedItem = self.resultTbl[row_idx][index]
local queryId = self.queryIdTbl and self.queryIdTbl[row_idx]

if selectedItem and queryId then
-- ConPrintf("Fetching tokens for item %s in row %d", selectedItem.id, row_idx)
self.tradeQueryRequests:FetchSingleItem(selectedItem.id, queryId, function(newItemData, errMsg)
if errMsg then
-- ConPrintf("Error fetching single item token: %s", errMsg)
selectedItem.whisper_token = nil
selectedItem.hideout_token = nil
return
end
if newItemData then
selectedItem.whisper_token = newItemData.whisper_token
selectedItem.hideout_token = newItemData.hideout_token
-- ConPrintf("Successfully updated tokens for item %s", selectedItem.id)
end
end)
else
-- ConPrintf("Missing item data or queryId for row %d, cannot fetch fresh token.", row_idx)
end

@Nightblade Nightblade Sep 4, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, just a couple of minor things I noticed -- these lines should use TABs for indentation , and it's spelled "referrer".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think it's probably better if I add a spelling exception for "referer" given its historical (mis)use in this context, so please disregard that part of my review.

@Mizkii Mizkii closed this Sep 4, 2025
@Mizkii Mizkii deleted the direct-whisper-or-teleport branch September 6, 2025 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature, calculation, or mod pob1 Should also be merged into PoB1 Repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trade whisper alternative for console player

3 participants